#pragma once
#include <vector>
#include <set>
#include <string>
#include <iostream>

using namespace std;

struct Edge {
    int u, v;
    bool operator<(const Edge& other) const {
        return u < other.u || (u == other.u && v < other.v);
    }
};

class PlanarGraphGenerator {
public:
    PlanarGraphGenerator();
    void generate(const string& filename, int target_vertex_count);

private:
    vector<vector<int>> adj;
    set<Edge> edge_set;

    vector<int> getFace(int current_vertex_count);
    void insertVertexIntoFace(int new_vertex, const vector<int>& face);
    void saveGraphToFile(const string& filename, int vertex_count);
};